package com.mx.zb.md.tenant.dao;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.mx.zb.md.tenant.bo.Operator;

@Mapper
public interface OperatorMapper {

	@Select("SELECT * FROM operator;")
    List<Operator> getAll();

    @Select("SELECT * FROM operator WHERE id = #{id}")
    Operator get(@Param("id") String id);
    
    @Select("SELECT count(*) FROM operator WHERE name = #{name} and password = #{password}")
    int getCount(Operator o);

    @Insert("INSERT INTO operator (id,name,password) VALUES( #{id}, #{name}, #{password})")
    int insertOne(Operator o);

    @Update("UPDATE operator SET name = #{name},password = #{password}" +
            "WHERE id = #{id}")
    int updateOne(Operator o);
    
}
